import React, { Component } from 'react';

class UserDetail extends Component {

    render() {
        let users = JSON.parse(localStorage.getItem('USERS') || "[]");
        let id = this.props.match.params.id;
        let user = users.find(item => item.id === id);
        return (
            <table className="table table-bordered">
                <thead>
                    <tr>
                        <th>ID</th>
                        <th>用户名</th>
                        <th>密码</th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td>{user.id}</td>
                        <td>{user.username}</td>
                        <td>{user.password}</td>
                    </tr>
                </tbody>
            </table>
        );
    }
}

export default UserDetail;